﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories;

namespace LiveShopvnext.Commods
{
    
        public class CommonAppService :
        CrudAppService<
            CommodInfo, //The Book entity
            CommodInfoDTO, //Used to show books
            Guid, //Primary key of the book entity
            CommodListDto, //Used for paging/sorting
            CreateUpdateCommodDto>, //Used to create/update a book
        ICommonAppService //implement the IBookAppService
    {
        public CommonAppService(IRepository<CommodInfo, Guid> repository)
            : base(repository)
        {

        }
        [Obsolete]
        protected override IQueryable<CommodInfo> CreateFilteredQuery(CommodListDto input)
        {
            if(!string.IsNullOrEmpty(input.Name))
            {
                return base.CreateFilteredQuery(input).Where(b => b.CommodityName.Contains(input.Name)&& b.CommodityState==input.IsDeleted);
            }
            else
            {
            return base.CreateFilteredQuery(input).Where(b => b.CommodityState == input.IsDeleted);
            }

        }
    }
    

        
       
    
}
